#include "UdpServe.h"
#include "comm.h"
#include "Dictionary.h"
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        std::cerr << "Usage: " << argv[0] << " localport" << std::endl;
        Die(1);
    }
    // std::string ip = argv[1];
    uint16_t port = std::stoi(argv[1]);

    ENABLE_CONSOLE_LOG();
    std::shared_ptr<Dictionary> dict_ptr = std::make_shared<Dictionary>();
    std::unique_ptr<UdpServe> str_ptr = std::make_unique<UdpServe>([&dict_ptr](const std::string &word)
                                                                   { return dict_ptr->Translate(word); },
                                                                   port);
    str_ptr->InitServe();
    str_ptr->Start();
    return 0;
}